//
//  ORMKeyValueStore.h
//  ORM
//
//  Created by PH on 21.12.09.
//  Copyright 2009-2010 Codesign. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol ORMKeyValueStore

- (id)initWithPath:(NSString*)path autosync:(BOOL)_autosync;
- (BOOL)isReady;
- (BOOL)putMap:(NSDictionary*)dict forKey:(NSString*)key;
- (NSArray*)getMapsWithCriteria:(NSDictionary*)criteria;
- (NSArray*)getMapsWithCriteria:(NSDictionary*)criteria condBlock:(void(^)(void*))condBlock;
- (NSDictionary*)getMapForKey:(NSString*)key;
- (BOOL)removeMapForKey:(NSString*)key;
- (BOOL)removeRecordsMatchingCriteria:(NSDictionary*)criteria;
- (BOOL)createIndexOnField:(NSString*)fieldName rebuild:(BOOL)rebuild;
- (BOOL)beginTransaction;
- (BOOL)commitTransaction;
- (BOOL)rollbackTransaction;
- (NSString*)uniqueKey;
- (NSString*)lastErrorString;
- (void(^)(void*))stringEqualConditionWithColumnName:(NSString*)columnName value:(NSString*)value;
- (void(^)(void*))stringIncludedConditionWithColumnName:(NSString*)columnName value:(NSString*)value;
- (void(^)(void*))numberLessThanConditionWithColumnName:(NSString*)columnName value:(double)value;
- (void(^)(void*))numberGreaterThanConditionWithColumnName:(NSString*)columnName value:(double)value;
- (void(^)(void*))numberEqualConditionWithColumnName:(NSString*)columnName value:(double)value;
- (void)close;

@end
